﻿<UserControl x:Class="iControl.Controls.Rating"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
        <Grid.Resources>
            <ControlTemplate x:Key="StarsTemplate"  TargetType="{x:Type ToggleButton}">
            	<ControlTemplate.Resources>
            		<Storyboard x:Key="FadeInAnimation">
            			<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="star" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
            				<SplineColorKeyFrame KeyTime="00:00:00.3000000" Value="#FFFFA500"/>
            			</ColorAnimationUsingKeyFrames>
            			<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="star" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
            				<SplineColorKeyFrame KeyTime="00:00:00.3000000" Value="#FFF7D38E"/>
            			</ColorAnimationUsingKeyFrames>
            			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="star" Storyboard.TargetProperty="(Shape.StrokeThickness)">
            				<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="2"/>
            			</DoubleAnimationUsingKeyFrames>
            			<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="star" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
            				<SplineColorKeyFrame KeyTime="00:00:00.3000000" Value="#FF9B3F00"/>
            			</ColorAnimationUsingKeyFrames>
            		</Storyboard>
					<Storyboard x:Key="FadeOutAnimation">
            			<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="star" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
            				<SplineColorKeyFrame KeyTime="00:00:00.3000000" Value="#FFD3D3D3"/>
            			</ColorAnimationUsingKeyFrames>
            			<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="star" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
            				<SplineColorKeyFrame KeyTime="00:00:00.3000000" Value="#FFD3D3D3"/>
            			</ColorAnimationUsingKeyFrames>
            			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="star" Storyboard.TargetProperty="(Shape.StrokeThickness)">
            				<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
            			</DoubleAnimationUsingKeyFrames>
            			<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="star" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
            				<SplineColorKeyFrame KeyTime="00:00:00.3000000" Value="#FF575757"/>
            			</ColorAnimationUsingKeyFrames>
            		</Storyboard>
            	</ControlTemplate.Resources>
                <Viewbox>
                    <Path Name="star" Data="F1 M 145.637,174.227L 127.619,110.39L 180.809,70.7577L 114.528,68.1664L 93.2725,5.33333L 70.3262,67.569L 4,68.3681L 56.0988,109.423L 36.3629,172.75L 91.508,135.888L 145.637,174.227 Z" Stroke="#FF434343">
                    	<Path.Fill>
                    		<RadialGradientBrush>
                    			<GradientStop Color="#FFD3D3D3" Offset="0"/>
                    			<GradientStop Color="#FFEAEAEA" Offset="1"/>
                    		</RadialGradientBrush>
                    	</Path.Fill>
                    </Path>
                </Viewbox>
                <ControlTemplate.Triggers>
            		<Trigger Property="IsChecked" Value="True">
            			<Trigger.ExitActions>
            				<BeginStoryboard Storyboard="{StaticResource FadeOutAnimation}" x:Name="FadeOutAnimation_BeginStoryboard"/>
            			</Trigger.ExitActions>
            			<Trigger.EnterActions>
            				<BeginStoryboard Storyboard="{StaticResource FadeInAnimation}"/>
            			</Trigger.EnterActions>
            		</Trigger>
            	</ControlTemplate.Triggers>
            </ControlTemplate>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <ToggleButton Grid.Column="0" Tag="1" Cursor="Hand" Template="{StaticResource StarsTemplate}" Click="Stars_Click" x:Name="star1"/>
        <ToggleButton Grid.Column="1" Tag="2" Cursor="Hand" Template="{StaticResource StarsTemplate}" Click="Stars_Click" x:Name="star2"/>
        <ToggleButton Grid.Column="2" Tag="3" Cursor="Hand" Template="{StaticResource StarsTemplate}" Click="Stars_Click" x:Name="star3"/>
        <ToggleButton Grid.Column="3" Tag="4" Cursor="Hand" Template="{StaticResource StarsTemplate}" Click="Stars_Click" x:Name="star4"/>
        <ToggleButton Grid.Column="4" Tag="5" Cursor="Hand" Template="{StaticResource StarsTemplate}" Click="Stars_Click" x:Name="star5"/>
    </Grid>
</UserControl>
